<div id="page-content">
	<div class="col-sm-12 eq-box-sm">
		<div class="panel ">
			<div class="panel-heading">
				<div class="panel-control" style="padding:10px 15px;">
					<button class="btn btn-default" data-target="#demo-panel-collapse-default" data-toggle="collapse"
							aria-expanded="true">
						<i class="demo-pli-arrow-down"></i>
					</button>
				</div>
				<h3 class="panel-title">
					查询搜索</h3>
			</div>
			<!--Panel body-->
			<div id="demo-panel-collapse-default" class="collapse in" aria-expanded="true">
				<div class="panel-body">
					<form class="form-inline">
						<input type="text" value="" hidden >
						<div class="form-group" style="width:30%">
							<label>发布时间:</label><input style="width:40%" type="text" value="" name="" class="form-control"
													   id="datetimeStart"/><i> - </i><input style="width:40%" type="text" name="" value=""
																							class="form-control"
																							id="datetimeEnd"/>
						</div>
						<div class="form-group">
							<input type="text" id="search" class="form-control" placeholder="请输入问卷标题" value="">
							<button class="btn btn-mint" type="button" onclick="search2()">搜索</button>
							<button class="btn btn-primary" type="button" onclick="reset2()">重置</button>
						</div>
					</form>
				</div>
			</div>
		</div>
		<div class="panel">
			<div class="panel-body">
				<table id="pageTable" class="demo-add-niftycheck" data-toolbar="#export"
					   data-search="true"
					   data-show-refresh="true"
					   data-show-toggle="true"
					   data-show-columns="true"
					   data-sort-name="id"
					   data-page-list="[5, 10, 20]"
					   data-page-size="5"
					   data-pagination="true" data-show-pagination-switch="true" ></table>
			</div>
		</div>
	</div>
</div>
<script>

	var col = [{
			field: 'checked',
			checkbox: true,
			align: 'center'
		},
		{
            field: 'paperTitle',
            title: '问卷标题',
            align: 'center'
		},
		{
			field: 'name',
			title: '发布人',
			align: 'center'
		},
		{
			field: 'createTime',
			title: '发布时间',
			align: 'center'
		},{
            field: 'total',
            title: '综合得分',
            align: 'center',
            formatter:function(value,row,index){
                return '<span style="color:red">'+value+'</span>'
            }
        },];
	var opt = {
		//请求方法
		method: 'get',
		//是否显示行间隔色
		striped: true,
		//是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
		cache: false,
		//data-toolbar: "#demo-delete-row",
		//是否显示分页（*）
		pagination: true,
		//是否启用排序
		sortable: false,
		//排序方式
		sortOrder: "asc",
		//初始化加载第一页，默认第一页
		//我设置了这一项，但是貌似没起作用，而且我这默认是0,- -
		//pageNumber:1,
		//每页的记录行数（*）
		pageSize: 10,
		//可供选择的每页的行数（*）
		pageList: [10, 25, 50, 100],
		//这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
		url: ctx+"/admin/paperuser/listData",
		//默认值为 'limit',传给服务端的参数为：limit, offset, search, sort, order Else
		//queryParamsType:'',
		////查询参数,每次调用是会带上这个参数，可自定义
		queryParams : function(params) {
			return {
				pageNumber: (params.offset/params.limit)+1,
				pageSize: params.limit,
				starttime:$("#datetimeStart").val(),
				endtime:$("#datetimeEnd").val(),
				search:$("#search").val()
			};
		},
		//分页方式：client客户端分页，server服务端分页（*）
		sidePagination: "server",
		//是否显示搜索
		search: false,
		//Enable the strict search.
		strictSearch: true,
		//Indicate which field is an identity field.
		idField : "id",
		columns: col,
		pagination:true,paginationShowPageGo: true
	};

	//表格
	function initTable(){
		$('#pageTable').bootstrapTable(opt);
		$('#pageTable').bootstrapTable('hideColumn', 'id');
	}
	function refreshTable(){
		$("#pageTable").bootstrapTable('refresh', opt);
		$('#pageTable').bootstrapTable('hideColumn', 'id');
	}

	function search2() {
		refreshTable()
	}

	function reset2() {
		$("#datetimeStart").val("");
		$("#datetimeEnd").val("");
		$("#search").val("");
		refreshTable()
	}

	function exportExcel(){
		//批量删除
		var data = [];
		$("#pageTable input[type='checkbox'][name!='btSelectAll']:checked").each(function(){
			data.push($(this).val());
		});
		if(data.length==0){
			pointLion.alertMsg("请选择要导出的数据!","danger",null,null);
			return;
		}
		exportE(data.join(","));//执行删除
	}

	function exportE(ids){
		window.location.href="#(ctx)/admin/paperuser/ExportExcel?ids="+ids;
	}

	$(document).ready(function(){
		$('#datetimeStart').datepicker({
			format: "yyyy-mm-dd",
			todayBtn: "linked",
			language:'zh-CN',
			autoclose: true,
			todayHighlight: true
		});
		$('#datetimeEnd').datepicker({
			format: "yyyy-mm-dd",
			todayBtn: "linked",
			autoclose: true,
			language:'zh-CN',
			todayHighlight: true
		});
		initTable();//初始化
	});
</script>